package com.lagou.homework.one;

public class Manager {
    //私有化成员变量
    private String name;
    private int id;
    private int salary;
    private int bonus;

    //无参数构造方法
    public Manager(){

    }
    //有参数构造方法
    public Manager(String name, int id, int salary, int bonus){
        setName(name);
        setId(id);
        setSalary(salary);
        setBonus(bonus);
    }

    //下面是setter，getter方法
    public void setName(String name){
        this.name = name;
    }

    public void setId(int id) {
        if (id > 0){
            this.id = id;
        }else{
            System.out.println("异常ID");
        }

    }

    public void setSalary(int salary) {
        if (salary > 3000){
            this.salary = salary;
        }else{
            System.out.println("异常salary");
        }

    }

    public void setBonus(int bonus) {
        this.bonus = bonus;
    }

    public String getName() {
        return name;
    }

    public int getId() {
        return id;
    }

    public int getSalary() {
        return salary;
    }

    public int getBonus() {
        return bonus;
    }

    //成员方法work()
    public void work(){
        System.out.print("工号为" + getId());
        System.out.print("基本工资为" + getSalary());
        System.out.print("奖金为" + getBonus());
        System.out.println("的项目经理" + getName()+"正在努力的做着管理工作,\n" +
                "  分配任务,检查员工提交上来的代码.....");

    }
}
